/*
 * Project : Linuxbox
 * File    : UserManAdd.java
 * Version : 1.0
 * Author  : Kevin Zhang
 *
 * Copyright (c) 2000-2001 by Linuxbox, Inc.
 * All rights reserved.
 */
package linuxbox.download.servlet;

import javax.servlet.http.*;

import linuxbox.BoxStatic;
import linuxbox.common.*;
import linuxbox.download.logic.*;

public class DlCatAddAction extends Action {
	protected static final String DL_CAT_ID_PARAM = "DL_CAT_ID";         
	protected static final String DL_CAT_NAME_PARAM = "DL_CAT_NAME";
	protected static final String DL_CAT_DIR_PARAM = "DL_CAT_DIR";
	protected static final String DL_CAT_DESC_PARAM = "DL_CAT_DESC";
	protected static final String check = "CHECKED";

	protected static String successJSP = null;
	
    public void doAction(HttpSession aSession, BoxSession aBoxSession, 
    HttpServletRequest req, HttpServletResponse res) throws Exception {
		BoxStatic.logger.debug("I am in DlCatAddAction now ... ");
		
		String CatName = req.getParameter(DL_CAT_NAME_PARAM);
		String CatDir = req.getParameter(DL_CAT_DIR_PARAM);			
		String CatDesc = req.getParameter(DL_CAT_DESC_PARAM);
	
		BoxStatic.logger.debug("CatName is " + CatName);
		BoxStatic.logger.debug("CatDir is " + CatDir);
		BoxStatic.logger.debug("CatDesc is " + CatDesc);
		
		DlCatObject dlco = new DlCatObject(CatName, CatDir, CatDesc);
		DownLoadManager dlm = DownLoadManager.getInstance();
		dlm.addDlCat(dlco);
		
		redirectFile(successJSP, req, res);
		
		BoxStatic.logger.debug("I am leaving DlCatAddAction now ... ");
	}

	public void setSuccessJSP(String str) {
		successJSP = str;
	}
}
